home *** CD-ROM | disk | FTP | other *** search
- /*
- ** GadTools layout toolkit
- **
- ** Copyright © 1993-1996 by Olaf `Olsen' Barthel
- ** Freely distributable.
- **
- ** :ts=4
- */
-
- #ifndef _GTLAYOUT_GLOBAL_H
- #include "gtlayout_global.h"
- #endif
-
- #ifdef DO_FRACTION_KIND
- ULONG __saveds __asm
- LTP_FracEditRoutine(REG(a0) struct Hook *Hook,REG(a2) struct SGWork *Work,REG(a1) ULONG *Msg)
- {
- if(*Msg == SGH_KEY)
- {
- if(Work->IEvent->ie_Code == 0x5F)
- {
- LayoutHandle *Handle = Hook->h_Data;
-
- if(Handle->HelpHook)
- {
- Work->Code = 0x5F;
- Work->Actions = (Work->Actions & ~SGA_BEEP) | SGA_END | SGA_USE;
-
- LTP_AddHistory(Work);
-
- return(TRUE);
- }
- }
-
- if(Work->IEvent->ie_Code == CURSORUP || Work->IEvent->ie_Code == CURSORDOWN)
- LTP_HandleHistory(Work);
-
- if(Work->EditOp == EO_ENTER)
- {
- LayoutHandle *Handle = Hook->h_Data;
- ObjectNode *Node;
- BOOL Activate = TRUE;
-
- if(GETOBJECT(Work->Gadget,Node))
- {
- if(Node->Type == FRACTION_KIND && Node->Special.String.LastGadget)
- Activate = FALSE;
- }
-
- if(!(Work->IEvent->ie_Qualifier & QUALIFIER_SHIFT))
- {
- if(Activate && Handle->AutoActivate)
- Work->Actions |= SGA_NEXTACTIVE;
-
- if(!(Work->Actions & SGA_NEXTACTIVE))
- Work->Code = '\r';
- }
- }
-
- if(Work->EditOp == EO_INSERTCHAR || Work->EditOp == EO_REPLACECHAR)
- {
- LONG DecimalPoint = (LTP_Locale ? LTP_Locale->loc_DecimalPoint[0] : '.');
-
- if(Work->Code == DecimalPoint || (Work->Code >= '0' && Work->Code <= '9'))
- {
- if(Work->Code == DecimalPoint)
- {
- LONG i;
- BOOL UseIt = TRUE;
-
- for (i = 0 ; UseIt && i < Work->NumChars ; i++)
- {
- if(Work->PrevBuffer[i] == DecimalPoint)
- UseIt = FALSE;
- }
-
- if(!UseIt)
- {
- Work->Actions &= ~SGA_USE;
- Work->Actions |= SGA_BEEP;
- }
- }
- }
- else
- {
- Work->Actions &= ~SGA_USE;
- Work->Actions |= SGA_BEEP;
- }
- }
-
- if(Work->Actions & SGA_END)
- LTP_AddHistory(Work);
- }
- else
- {
- if(*Msg != SGH_CLICK)
- return(FALSE);
- }
-
- return(TRUE);
- }
- #endif
-